﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site/QuanLyDuoc/QuanLyDuoc_OffCanvas.Master" AutoEventWireup="true" CodeBehind="PhieuXuatKhoSangKho.aspx.cs" Inherits="HospitalManager.QuanLyDuoc.HeThongNhapXuat.PhieuXuatKhoSangKho.PhieuXuatKhoSangKho" %>

<%@ Register TagPrefix="uc3" TagName="HeThongNhapXuat_LeftMenu" Src="~/QuanLyDuoc/HeThongNhapXuat/HeThongNhapXuat_LeftMenu.ascx" %>
<%@ Register Src="uc_Phieu.ascx" TagName="uc_Phieu" TagPrefix="uc1" %>
<%@ Register Src="uc_ChiTietPhieu.ascx" TagName="uc_ChiTietPhieu" TagPrefix="uc2" %>
<%@ Register Src="uc_ViewPhieu.ascx" TagName="uc_ViewPhieu" TagPrefix="uc4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="/AjaxJquery/QuanLyDuoc/HeThongNhapXuat/jsPhieuXuatKhoSangKho.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent" runat="server">
    <uc3:HeThongNhapXuat_LeftMenu ID="HeThongNhapXuat_LeftMenu1" runat="server" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row">
        <div class="col-xs-12 col-md-12">
            <div class="page-header" style="margin: 0 0 10px;">
                <h1 style="margin: 0; font-weight: bold; color: #3070A7; font-size: 30px;">
                    <small class="breadcrumb" style="font-size: 50%; background-color: #ffffff; padding: 0 15px;">
                        <li><a href="/duoc/nhap-xuat">HỆ THỐNG NHẬP XUẤT</a></li>
                        <li class="active">PHIẾU XUẤT KHO SANG KHO</li>
                    </small>
                </h1>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12 col-md-12">
            <div class="col-xs-3 col-md-3">
                <asp:DropDownList ID="ddlKho_Khoa" ClientIDMode="Static" runat="server">
                </asp:DropDownList>
            </div>
            <div class="col-xs-4 col-md-4">
                <div class="input-group">
                    <span class="input-group-addon">Từ ngày</span>
                    <asp:TextBox ID="txtTuNgay" ClientIDMode="Static" runat="server" CssClass="form-control ipdate dateFormat"
                        placeholder="Từ ngày"></asp:TextBox>
                    <span class="input-group-addon" style="border-right: 0;">đến ngày</span>
                    <asp:TextBox ID="txtDenNgay" ClientIDMode="Static" runat="server" CssClass="form-control ipdate dateFormat"
                        placeholder="Đến ngày"></asp:TextBox>
                </div>
            </div>
            <div class="col-xs-3 col-md-3">
                <asp:Button ID="btnTimKiem" ClientIDMode="Static" runat="server" Text="Tìm kiếm" CssClass="btn btn-default"
                    OnClientClick=" validationform_Timkiem() " OnClick="btnTimKiem_Click" />
            </div>
        </div>
    </div>
    <div class="row" style="margin-top: 10px;">
        <div class="col-md-12">
            <div class="form-group table-responsive">
                <asp:GridView ID="gvPhieuXuatKhoSangKho" runat="server" AutoGenerateColumns="False" Width="100%"
                    CssClass="table table-bordered table-condensed" DataKeyNames="MaPhieuYeuCau" OnRowDataBound="gvPhieuXuatKhoSangKho_RowDataBound">
                    <Columns>
                        <asp:BoundField DataField="RowNumber" HeaderText="STT">
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="NgayYeuCau" HeaderText="Ngày yêu cầu" DataFormatString="{0:dd-MM-yyyy}">
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="NguoiYeuCau" HeaderText="Người yêu cầu"></asp:BoundField>
                        <asp:BoundField DataField="TenKhoYeuCau" HeaderText="Kho yêu cầu"></asp:BoundField>
                        <asp:BoundField DataField="NgayXuat" HeaderText="Ngày xuất" DataFormatString="{0:dd-MM-yyyy}">
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="NguoiXuat" HeaderText="Người xuất"></asp:BoundField>
                        <asp:BoundField DataField="TenKhoXuat" HeaderText="Kho xuất"></asp:BoundField>
                        <asp:BoundField DataField="TrangThai" HeaderText="Trạng thái">
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="IsXetDuyet" HeaderText="IsXetDuyet" Visible="False"></asp:BoundField>
                        <asp:BoundField DataField="MaPhieuXuat" HeaderText="MaPhieuXuat" Visible="False"></asp:BoundField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:LinkButton ID="btnThucHienXuatKhoSangKho" ClientIDMode="Static" runat="server" ToolTip="Thực hiện xuất vật tư"
                                    CssClass="btn btn-primary" maphieuyeucau='<%# Eval("MaPhieuYeuCau") %>' maphieuxuatkhosangkho='<%# Eval("MaPhieuXuat") %>'
                                    OnClientClick="xuatkhosangkho(this);" href="javascript:void(0)">
                                    <i class="glyphicon glyphicon-circle-arrow-right"></i>
                                </asp:LinkButton>
                                <div class="btn-group dropup">
                                    <asp:LinkButton ID="btnDropDownTraLaiPhieuYeuCauXuatVatTu" runat="server" ToolTip="Trả lại phiếu yêu cầu xuất vật tư"
                                        CssClass="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-expanded="false" OnClientClick="$('.dropdown-menu-form').find('input:text').val('');">
                                        <i class="glyphicon glyphicon-share"></i>
                                    </asp:LinkButton>
                                    <ul class="dropdown-menu dropdown-menu-right dropdown-menu-form" role="menu" style="width: 460px;">
                                        <li>
                                            <div class="col-xs-12 col-md-12" style="margin-top: 10px;">
                                                <div class="form-horizontal">
                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label">
                                                            Lý do</label>
                                                        <div class="col-sm-10">
                                                            <asp:TextBox ID="txtGhiChu" runat="server" CssClass="form-control"></asp:TextBox>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </li>
                                        <li>
                                            <div class="col-xs-12 col-md-12">
                                                <div class="form-horizontal">
                                                    <div class="form-group">
                                                        <div class="col-sm-offset-2 col-sm-10">
                                                            <asp:LinkButton ID="btnTraLaiPhieuYeuCauXuatVatTu" runat="server" Text="Chấp nhận"
                                                                CssClass="btn btn-success" CommandArgument='<%# Eval("MaPhieuYeuCau") %>'
                                                                OnClick="btnTraLaiPhieuYeuCauXuatVatTu_Click">
                                                            </asp:LinkButton>
                                                            <asp:LinkButton ID="btnThoat" runat="server" Text="Thoát" CssClass="btn btn-danger"
                                                                OnClientClick="$('.dropdown-menu-form').parent().removeClass('open');" href="javascript:void(0)"></asp:LinkButton>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                                <asp:LinkButton ID="btnDuyetPhieuXuatKhoSangKho" ClientIDMode="Static" runat="server" ToolTip="Duyệt phiếu"
                                    CssClass="btn btn-info" CommandArgument='<%# Eval("MaPhieuXuat") %>' OnClick="btnDuyetPhieuXuatKhoSangKho_Click">
                                    <i class="glyphicon glyphicon-check"></i>
                                </asp:LinkButton>
                                <asp:LinkButton ID="btnXoaPhieuXuatKhoSangKho" ClientIDMode="Static" runat="server" ToolTip="Xóa phiếu"
                                    CssClass="btn btn-danger" CommandArgument='<%# Eval("MaPhieuXuat") %>'
                                    OnClick="btnXoaPhieuXuatKhoSangKho_Click" OnClientClick="return showconfirm(this.id);">
                                    <i class="glyphicon glyphicon-trash"></i>
                                </asp:LinkButton>
                                <asp:LinkButton ID="btnViewPhieu" ClientIDMode="Static" runat="server" ToolTip="Xem thông tin phiếu"
                                    CssClass="btn btn-success" maphieuyeucau='<%# Eval("MaPhieuYeuCau") %>' maphieuxuatkhosangkho='<%# Eval("MaPhieuXuat") %>'
                                    OnClientClick="viewphieuxuatkhosangkho(this);" href="javascript:void(0)">
                                    <i class="glyphicon glyphicon-search"></i>
                                </asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="15%" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
        </div>
        <div class="col-md-6" style="text-align: right;">
            <asp:DataList RepeatDirection="Horizontal" runat="server" ID="dlPager" OnItemCommand="dlPager_ItemCommand"
                CssClass="tbPage">
                <ItemTemplate>
                    <asp:LinkButton Enabled='<%#Eval("Enabled") %>' runat="server" ID="lnkPageNo" Text='<%#Eval("Text") %>'
                        CommandArgument='<%#Eval("Value") %>' CommandName="PageNo"></asp:LinkButton>
                </ItemTemplate>
            </asp:DataList>
        </div>
    </div>
    <asp:HiddenField ID="hfPageIndex" runat="server" Value="1" />
    <script type="text/javascript">
        $(function () {
            $("#li_phieuxuatkhosangkho").addClass("active");
            $("#li_hethongnhapxuat").addClass("active");
            $(".dropdown-menu-form").on("click", function (e) {
                $(this).find("input:text:first").focus();
                e.stopPropagation();
            });
        });
        var confirmed = false;
        function showconfirm(controlId) {
            if (confirmed) return true;
            bootbox.confirm("Bạn có chắc chắn xóa?", function (result) {
                if (result) {
                    if (controlId != null) {
                        var controlToClick = document.getElementById(controlId);
                        if (controlToClick != null) {
                            confirmed = true;
                            $("#form_Main").validate().cancelSubmit = true;
                            controlToClick.click();
                            confirmed = false;
                        }
                    }
                }
            });
            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="FormContent" runat="server">
    <div id="div_phieuxuatkhosangkho" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static"
        data-focus-on="#txtNguoiXuat" data-width="98%" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" style="line-height: 1;">
                        <span>&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="myModalLabel">Phiếu xuất kho sang kho</h4>
                </div>
                <div class="modal-body modal-fullheight">
                    <div class="row">
                        <div class="col-xs-12 col-md-12">
                            <ul id="ul_tab_phieuxuatkhosangkho" class="nav nav-tabs" role="tablist">
                                <li role="presentation" class="active"><a href="#tab_phieuxuatkhosangkho" role="tab" data-toggle="tab">Phiếu xuất kho sang kho</a></li>
                                <li role="presentation"><a href="#tab_phieuxuatkhosangkho_chitiet" role="tab" data-toggle="tab">Chi tiết phiếu</a></li>
                            </ul>
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane active" id="tab_phieuxuatkhosangkho">
                                    <form id="form_phieuxuatkhosangkho_thongtinphieu">
                                        <uc1:uc_Phieu ID="uc_Phieu1" runat="server" />
                                    </form>
                                </div>
                                <div role="tabpanel" class="tab-pane" id="tab_phieuxuatkhosangkho_chitiet">
                                    <form id="form_phieuxuatkhosangkho_chitietphieu">
                                        <uc2:uc_ChiTietPhieu ID="uc_ChiTietPhieu1" runat="server" />
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-4 col-md-4">
                            <div class="form-group">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li role="presentation" class="active"><a href="#tab_dsvattuyeucau" role="tab" data-toggle="tab">Thông tin vật tư yêu cầu</a></li>
                                </ul>
                                <div class="tab-content">
                                    <div role="tabpanel" class="tab-pane active" id="tab_dsvattuyeucau">
                                        <div class="table-responsive">
                                            <table id="tb_phieuyeucauxuatvattu_chitiet">
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-8 col-md-8">
                            <div class="form-group">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li role="presentation" class="active"><a href="#tab_dsvattuxuat" role="tab" data-toggle="tab">Thông tin vật tư xuất</a></li>
                                    <li role="presentation"><a href="#tab_dsvattuxuat_chitiet" role="tab" data-toggle="tab">Thông tin chi tiết vật tư xuất</a></li>
                                </ul>
                                <div class="tab-content">
                                    <div role="tabpanel" class="tab-pane active" id="tab_dsvattuxuat">
                                        <div class="table-responsive">
                                            <table id="tb_phieuxuatkhosangkho">
                                            </table>
                                        </div>
                                    </div>
                                    <div role="tabpanel" class="tab-pane" id="tab_dsvattuxuat_chitiet">
                                        <div class="table-responsive">
                                            <table id="tb_phieuxuatkhosangkho_chitiet">
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="div_phieuxuatkhosangkho_view" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static"
        data-width="98%" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" style="line-height: 1;">
                        <span>&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="myModalLabel_view">Phiếu xuất kho sang kho</h4>
                </div>
                <div class="modal-body modal-fullheight">
                    <uc4:uc_ViewPhieu ID="uc_ViewPhieu1" runat="server" />
                </div>
            </div>
        </div>
    </div>
</asp:Content>
